<template>
	<view class="page_islogin">
		<view class="isLogin_top">
			<view class="btn_top">
				<uni-icons type="gear" color="#fff" size="24" @click="setUp"></uni-icons>
			</view>
			<view class="top">
				<view class="img_wrap" @click="goToDetail">
					<image class="user_img"  :src="userInfo.icon"></image>
				</view>
				<view class="right">
					<view class="name_wrap">
						<text class="name">{{userInfo.appName}}</text>
					</view>
					<view class="process">
						<text class="levT">S{{detailData.currentLeveL || 0}}</text>
						<progress class="jdt" :percent="percent || 0" active stroke-width="4" activeColor="#FFFFFF"
							backgroundColor="#8588F4" />
						<text class="levT">S{{detailData.currentLeveL?detailData.currentLeveL+1: 0}}</text>
					</view>
					<view class="intro">距下一级经纪人还需要 {{detailData.needExperience}}元</view>
				</view>
			</view>
		</view>
		<!--end isLogin_top-->
		<view class="get_next">
			<view class="title">即将获得:</view>
			<view class="list_wrap">
				<view v-for="item in dataList" :key="item" class="list_item">{{item}}</view>
			</view>
		</view>
		<!--end get_next-->

		<view class="nologin_con">
			<view class="list_wrap">
				<navigator class="item" hover-class="none" url="/pages/user/inside/balance/balance">
					<image class="img" mode="aspectFit" src="../../../static/image/page/ye.png"></image>
					<view class="title">账户余额</view>
					<view>
						<uni-icons type="arrowright"></uni-icons>
					</view>
				</navigator>
				<navigator class="item" hover-class="none" url="/pages/user/inside/widthList">
					<image class="img" mode="aspectFit" src="../../../static/image/page/tx.png"></image>
					<view class="title">提现记录</view>
					<uni-icons type="arrowright"></uni-icons>
				</navigator>
				<navigator class="item" hover-class="none" url="/pages/user/inside/revenue">
					<image class="img" mode="aspectFit" src="../../../static/image/page/sz.png"></image>
					<view class="title">收支流水</view>
					<uni-icons type="arrowright"></uni-icons>
				</navigator>
				<navigator class="item" hover-class="none" url="/pages/bank/index">
					<image class="img" mode="aspectFit" src="../../../static/image/page/bank.png"></image>
					<view class="title">我的银行卡</view>
					<uni-icons type="arrowright"></uni-icons>
				</navigator>
			</view>
			<view class="list_wrap">
				<navigator class="item" hover-class="none" url="/pages/message/index">
					<image class="img" mode="aspectFit" src="../../../static/image/page/message.png"></image>
					<view class="title">我的消息</view>
					<view>
						<uni-icons type="arrowright"></uni-icons>
					</view>
				</navigator>
				<view class="item" hover-class="none" @click="callPhone">
					<image class="img" mode="aspectFit" src="../../../static/image/page/kf.png"></image>
					<view class="title">专属客服</view>
					<uni-icons type="arrowright"></uni-icons>
				</view>
			</view>
		</view>
		<!-- <view class="sigin_out">
			<button class="btn" @click="signOut">退出</button>
		</view> -->
	</view>
</template>

<script>
	import {
		mapState,
		mapActions,
		mapMutations
	} from "vuex";
	export default {
		data() {
			return {
				detailData: {},
				dataList: ["业绩额外奖金点数升级为0.8%", "团队成员上线升级为30人"],
				percent: 0,
			};
		},
		computed: {
			...mapState(["userInfo"]),
		},
		created() {
			this.getUserDetail()
		},
		methods: {
			//打电话
			callPhone(){
				uni.makePhoneCall({
					phoneNumber:'023-67456888'
				})
			},
			...mapActions(["reLogin"]),
			//退出
			signOut() {
				this.reLogin();
			},
			//设置按钮
			setUp() {
				uni.navigateTo({
					url: "/pages/userSet/userSet"
				})
			},
			goToDetail() {
				uni.navigateTo({
					url: "/pages/userSet/userInfo"
				})
			},
			//获取用户详细信息
			getUserDetail() {
				this.$api.getUserDetail().then(res => {
					this.detailData = res.data.data;
					let newInfo = JSON.parse(JSON.stringify(this.userInfo));
					newInfo.grade = res.data.data.currentLeveL;
					this.$store.commit("SET_USERINFO", newInfo);
					//获取奖励文本，将字符串转为数组
					let levelText = res.data.data.levelText;
					if (levelText) {
						this.dataList = res.data.data.levelText.split(";")
					}
					this.percent = res.data.data.rate;
				})
			}
		}
	}
</script>

<style lang="scss">
	.isLogin_top {
		width: 750rpx;
		height: 340rpx;
		background: $dtg-color-primary;
		margin: 0 auto;
		padding: 0 30rpx;

		.btn_top {
			line-height: 88rpx;
			text-align: right;
		}

		.top {
			display: flex;
			justify-content: flex-start;
			align-items: center;
			padding-right: 100rpx;
			height: 146rpx;

			.user_img {
				width: 100rpx;
				height: 100rpx;
				border-radius: 50%;
				overflow: hidden;
				margin-right: 36rpx;
				border: 2rpx solid #FFFFFF;
			}

			.name {
				font-size: 32rpx;
				font-weight: bold;
				color: #FFFFFF;
				margin-right: 20rpx;
			}

			.level {
				background: #F96363;
				border-radius: 4px;
				padding: 4rpx 10rpx;
				font-size: 22rpx;
				color: #FFFFFF;
			}

			.process {
				display: flex;
				justify-content: space-between;
				align-items: center;
			}

			.levT {
				font-family: unidin;
				font-size: 28rpx;
				font-weight: bold;
				font-style: italic;
				color: #FFFFFF;
			}

			.jdt {
				margin: 0 15rpx;
			}

			.intro {
				font-size: 24rpx;
				color: #FFFFFF;
			}
		}
	}

	.get_next {
		width: 690rpx;
		padding: 30rpx;
		margin: -70rpx auto 30rpx;
		border-radius: 20rpx;
		background: #FFFFFF;

		.title {
			font-size: 28rpx;
			font-weight: bold;
			color: #333333;
			line-height: 58rpx;
		}

		.list_item {
			font-size: 26rpx;
			color: #999999;
			line-height: 40rpx;
			padding-left: 72rpx;
			position: relative;
		}

		.list_item:before {
			content: "";
			width: 8rpx;
			height: 8rpx;
			border-radius: 50%;
			background: $dtg-color-primary;
			position: absolute;
			left: 42rpx;
			top: 18rpx
		}
	}

	.nologin_con {
		width: 750rpx;
		padding: 0 30rpx;
		margin: 0 auto;

		.list_wrap {
			padding: 0 30rpx;
			background: #FFFFFF;
			border-radius: 20rpx;
			margin-bottom: 30rpx;
		}

		.item {
			height: 110rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			border-bottom: 2rpx solid #F8F8F8;
		}

		.img {
			width: 42rpx;
			height: 42rpx;
		}

		.title {
			flex: 1;
			padding-left: 20rpx;
		}
	}

	.sigin_out {
		text-align: center;
		margin: 84rpx 0 78rpx;

		.btn {
			width: 300rpx;
			height: 80rpx;
			text-align: center;
			line-height: 80rpx;
			background: #FFFFFF;
			border-radius: 40rpx;
			font-size: 32rpx;
		}

		.btn:after {
			border: none;
		}
	}
</style>
